package com.xingkeduo.dto;

import com.xingkeduo.pojo.enums.CommentStar;
import com.xingkeduo.pojo.table.Comments;
import com.xingkeduo.utils.TableAnnotations;
import lombok.Data;
import org.apache.commons.lang.StringUtils;

import java.time.LocalDateTime;

@Data
public class QueryCommetsDto {

    @TableAnnotations("服务评分")
    private CommentStar commentStar;

    //服务评分
    private int commentStarNum;
    //星级描述
    private String commentStarDescribe;

    @TableAnnotations("是否匿名")
    private Boolean anonymous;

    //评价时间
    private LocalDateTime CreatedTime;

    @TableAnnotations("原评价内容（未过滤）")
    private String commentNotFilter;

    @TableAnnotations("评价（已过滤）")
    private String comment;

    @TableAnnotations("服务类型Id")
    private String serviceTypeId;

    @TableAnnotations("服务类型名称")
    private String serviceTypeName;

    @TableAnnotations("店铺名称")
    private String storeName;

    @TableAnnotations("手艺人名称")
    private String adminName;

    @TableAnnotations("开始服务时间")
    private LocalDateTime serveStartTime;

    @TableAnnotations("用户手机号")
    private String userMobile;

    @TableAnnotations("订单ID")
    private String orderId;

    @TableAnnotations("订单号")
    private String orderNo;


    @TableAnnotations("用户昵称")
    private String userNickName;

    @TableAnnotations("是否生效")
    private Boolean isEffective;

    @TableAnnotations("星客多用户端展示")
    private Boolean shownToUser;

    @TableAnnotations("星客多发型师端展示")
    private Boolean shownToAdmin;







    /**
     * 评价标签
     */
    private String[] judgementLabels;

    /**
     * 图片列表
     */
    private String[] pics;

    public void covert(Comments comments){
        if(StringUtils.isNotEmpty(comments.getJudgementLabel())){
            this.judgementLabels = comments.getJudgementLabel().split(",");
        }

        if(StringUtils.isNotEmpty(comments.getPicIds())){
            this.pics = comments.getPicIds().split(",");
        }

        if(comments.getCommentStar()!=null){
            this.commentStarNum = comments.getCommentStar().getKey();
            this.commentStarDescribe=comments.getCommentStar().getValue();
        }
    }



}
